<script type="text/javascript">
	function receiveUdp() {
		var rows = clients_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	    	if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
	    	createFromWindow("UDP回复测试", "rtcs.do?receive&udid="+rows[0].udid, "",
					function(data) {
// 						reloadUnit();
					},false,800,600);
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}
	function operation() {
		var rows = clients_list.datagrid('getChecked');
	    if (rows&&rows.length>0){
	    	if(rows.length>1) {
				showMsg('请选择一条操作记录.');
				return;
			}
	    	createFromWindow("协议通信测试", "rtcs.do?operation&udid="+rows[0].udid, "",
					function(data) {
// 						reloadUnit();
					},false,1000,600);
	    }else {
	    	showMsg("请选择操作记录.");
	    }
	}
	
	
	function clearClientSearch() {
		setGridSearchParams('clients_list','clientSearchForm',true,reloadClients);
	}
	
	//根据条件查询
	function clientSearch() {
		setGridSearchParams('clients_list','clientSearchForm',false,reloadClients);
	}
	
	function reloadClients() {
		var params = clients_list.datagrid('options').queryParams; //先取得 datagrid 的查询参数  
		printLog(params);
		clients_list.datagrid('reload'); //设置好查询参数 reload 一下就可以了  
		clients_list.datagrid('unselectAll');
		clients_list.datagrid('uncheckAll');
	}
	
	function showOnlineClient() {
// 		createFromWindow("在线情况", "rtcs.do?online",
// 				null, null,false,1000,600);
		window.mainpage.clickMenuAddModelTab(999,"在线客户端",'999','rtcs.do?online','icon-standard-application-form',false);
	}
</script>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		
		<@eu.datagrid id="clients_list" toolbar="#clients_search" idField="id"
			 url="rtcs.do?loadOnlineClients" rownumbers="true"
			 item="com.xdtech.rtcs.vo.ClientInfo" pagination="false"/>
		
		<div id="clients_search">
			<div style="margin-bottom:5px;padding-left:5px;margin-top: 5px;">
				<form id="clientSearchForm">
					<table>
						<table>
						<tr>
							<td>所属项目：</td>
							<td>
							<@eu.comboBox url="shProject.do?loadProjectCombox&key=PROJECT_TYPE" name="projectId" onSelect="linkActionByProCombox('clientBuildId','clientUnitId','clientHouseId',null,value)"/>
							</td>
							<td class="tbLabel">所属楼栋:</td>
							<td>
								<@eu.comboBox id="clientBuildId" url="building.do?loadBuildingCombox" name="buildingId" onSelect="linkActionByBuildCombox('clientUnitId','clientHouseId',null,value)"/>
							</td>
							<td class="tbLabel">所属单元:</td>
							<td>
								<@eu.comboBox id="clientUnitId" url="unit.do?loadUnitCombox" name="unitId" onSelect="linkActionByUnitCombox('clientHouseId',null,value)"/>
							</td>
							<td class="tbLabel">所属房屋:</td>
							<td>
								<@eu.comboBox id="clientHouseId" url="house.do?loadHouseCombox" name="houseId" />
							</td>
							<td colspan="3">
								<@eu.linkbutton showName="查询" iconCls="icon-search" onclick="clientSearch()"/>
	 					 		<@eu.linkbutton showName="清空" iconCls="icon-clear" onclick="clearClientSearch()"/>
 					 		</td>
						</tr>
					</table>
				</form>
				
			</div>
			<div id="unit_toolbar" style="height: auto">
				<@eu.linkbutton showName="回复" shiro="rtcs:client:send" iconCls="icon-add" onclick="receiveUdp()"/>			
				<@eu.linkbutton showName="协议测试" shiro="rtcs:client:send" iconCls="icon-add" onclick="operation()"/>	
				<@eu.linkbutton showName="在线客户端" shiro="rtcs:client:online" iconCls="icon-add" onclick="showOnlineClient()"/>		
			</div>
		</div>
	</div>
</div>